{include file="public/head"/} 
  <body>
    <div class="x-nav">
      <span class="layui-breadcrumb">
        <a><cite>后台管理</cite></a>
        <a><cite>批量删除地库车</cite></a>
        <a><cite>地库车辆管理</cite></a>
      </span>
      <a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right" href="javascript:location.replace(location.href);" title="刷新">
        <i class="layui-icon" style="line-height:30px">ဂ</i></a>
    </div>
    <div class="x-body">
      <div class="layui-row">
        <form class="layui-form layui-col-md12 x-so"  method="get" action="#">
          <div class="layui-input-inline">
            <select name="out_parking_id" lay-filter="commname" id="commname">
              <option value="">所属停车场</option>
              {foreach $parkinglist as $parking}
              <option value="{$parking.out_parking_id}" {if isset($out_parking_id)}{if $out_parking_id == $parking.out_parking_id} selected {/if}{/if}>{$parking.parking_name}</option>
              {/foreach}
            </select>
          </div>
			<input type="text" class="layui-input" id="test5" name="start_time" placeholder="导入时间" {if isset($start_time)}value="{$start_time}"{/if}>
          <div class="layui-input-inline">
            <select name="page_number">
              <option value="">每页显示条数(默认100)</option>
              <option value="100" {if isset($page_number)}{if $page_number == '100'}selected{/if}{/if}>100</option>
              <option value="200" {if isset($page_number)}{if $page_number == '200'}selected{/if}{/if}>200</option>
			  <option value="300" {if isset($page_number)}{if $page_number == '300'}selected{/if}{/if}>300</option>
			  <option value="500" {if isset($page_number)}{if $page_number == '500'}selected{/if}{/if}>500</option>
			  <option value="1000" {if isset($page_number)}{if $page_number == '1000'}selected{/if}{/if}>1000</option>
            </select>
          </div>
          <button class="layui-btn"  lay-submit="" lay-filter="sreach"><i class="layui-icon">&#xe615;</i></button>
        </form>
      </div>
      <xblock>
		<button class="layui-btn" onclick="delAll()"><i class="layui-icon"></i>批量删除</button>
		<span class="x-right" style="line-height:40px">共有数据：{$number} 条</span>
      </xblock>
      <table class="layui-table" id="table">
        <thead>
          <tr>
            <th style="text-align: center; font-size: 16px;">
              <div class="layui-unselect header layui-form-checkbox" lay-skin="primary"><i class="layui-icon">&#xe605;</i></div>
            </th> 
			<th style="text-align: center; font-size: 16px;width:35px">ID</th>
            <th style="text-align: center; font-size: 16px; height: 30px;">停车场名称</th>
            <th style="text-align: center; font-size: 16px;">区域名称</th>
            <th style="text-align: center; font-size: 16px;">完整房号</th>
            <th style="text-align: center; font-size: 16px;">车库ID</th>
            <th style="text-align: center; font-size: 16px;">车牌号码</th>
            <th style="text-align: center; font-size: 16px;">车主姓名</th>
            <th style="text-align: center; font-size: 16px;">车主电话</th>
            <th style="text-align: center; font-size: 16px;">车位单价</th>
            <th style="text-align: center; font-size: 16px;">开始时间</th>
            <th style="text-align: center; font-size: 16px;">结束时间</th>
            <th style="text-align: center; font-size: 16px;">缴费时间</th>
            <th style="text-align: center; font-size: 16px;">状态</th>
            <th style="text-align: center; font-size: 16px;">备注</th>
            <th style="text-align: center; font-size: 16px;">添加时间</th>
           
          </tr>
        </thead>
        <tbody>
          {foreach $list as $lis}	
          <tr   >
            <td style="text-align: center;">
              <div class="layui-unselect layui-form-checkbox" lay-skin="primary" data-id='{$lis.id}'><i class="layui-icon">&#xe605;</i></div>
            </td>
			<td style="text-align: center;">{$lis.id}</td>
            <td style="text-align: center;">{$lis.out_parking_id}</td>
            <td style="text-align: center;">{$lis.community_id}</td>
            <td style="text-align: center;">{$lis.group}{$lis.building}幢{$lis.unit}单元{$lis.room}室</td>
            <td style="text-align: center;">{$lis.garage_id}</td>
            <td style="text-align: center;">{$lis.car_number}</td>
            <td style="text-align: center;">{$lis.name}</td>
            <td style="text-align: center;">{$lis.phone}</td>
            <td style="text-align: center;">{$lis.price}</td>
            <td style="text-align: center;">{$lis.in_time|date="Y-m-d H:i:s",###}</td>
            <td style="text-align: center;">{$lis.out_time|date="Y-m-d H:i:s",###}</td>
            <td style="text-align: center;">{$lis.pay_time}</td>
            <td style="text-align: center;">
              {if $lis.status == 1}
                  已上线
              {elseif $lis.status ==2}
                  未上线
              {/if}
            </td>
            <td style="text-align: center;">{$lis.remarks}</td>
            <td style="text-align: center;">{$lis.time}</td>
            
          </tr>
          {/foreach}
        </tbody>
      </table>
      <div class="page">
        <div>
            {$librarylist->render()}
        </div>
      </div>

    </div>
   <script>
   layui.use('laydate', function() {
            var laydate = layui.laydate;
            //日期时间选择器
            laydate.render({
                elem: '#test5'
                ,type: 'datetime'
            });
            
        });
		//批量删除
    function delAll () {
        var datas = $('#table tbody td .layui-form-checked')
        var ids = []
        datas.each(function(index, element){
          var id = $(this).data('id')
          ids.push(id)
        })

        var str = ids.join(',');
        var count = ids.length;
		//alert(count);
		if(count=="0"){
			alert('请选择要删除的选项');
			return ;
		}
        layer.confirm('你确定要删除这'+ count + '项吗', function(){
			
          $.post('{:url("librarydelAll")}', { id: str}, function(r){
            if (r.info) {
              layer.msg(r.info)
              location.reload()
            }else{
              layer.msg(r.error)
              location.reload()
            }
          })
        })
      }
    </script>
    <script>var _hmt = _hmt || []; (function() {
        var hm = document.createElement("script");
        hm.src = "https://hm.baidu.com/hm.js?b393d153aeb26b46e9431fabaf0f6190";
        var s = document.getElementsByTagName("script")[0];
        s.parentNode.insertBefore(hm, s);
      })();
    </script>
  </body>

</html>